define dpe
  if ($argc < 2)
    printf "Usage: dpe pe_type pe_config [enable]\n"
  end
  if ($argc >= 2)
    set $tmp=0
    while $tmp<$cpu_number
      eval "tvariable $pc_pe_type_%d%d_%d=%d",$arg0, $arg1, $tmp, $arg0
      eval "tvariable $pc_pe_config_%d%d_%d=%d",$arg0, $arg1, $tmp, $arg1
      eval "tvariable $pc_pe_val_%d%d_%d=0",$arg0, $arg1, $tmp
      if ($argc >= 3)
        eval "tvariable $pc_pe_en_%d%d_%d=%d",$arg0, $arg1, $tmp, $arg2
      end
      set $tmp=$tmp+1
    end
  end
end

dpe 0 0
dpe 0 1
dpe 0 2
dpe 0 3
dpe 0 4
dpe 0 5
dpe 0 6

set $tmp=0
while $tmp<$cpu_number
  eval "tvariable $pc_cc_%d",$tmp
  eval "tvariable $pc_cctmp_%d",$tmp
  eval "tvariable $pc_cr_%d",$tmp
  eval "tvariable $pc_crtmp_%d",$tmp
  eval "tvariable $pc_c_%d",$tmp
  set $tmp=$tmp+1
end

trace tcp_v4_rcv if ($cpu_id == 0)
  commands
    teval $pc_cctmp_0=$clock
    teval $pc_crtmp_0=$rdtsc
    teval $pc_pe_en=1
  end
list tcp_v4_rcv
#trace 1861 if ($cpu_id == 0)
trace 1771 if ($cpu_id == 0)
  commands
    teval $pc_pe_en=0
    teval $pc_cc_0=$clock-$pc_cctmp_0+$pc_cc_0
    teval $pc_cr_0=$rdtsc-$pc_crtmp_0+$pc_cr_0
    teval $pc_c_0=$pc_c_0+1
  end

define showall
  set $tmp=0
  while $tmp<$cpu_number
    printf "CPU%d\n",$tmp
    eval "p $pc_c_%d",$tmp
    eval "p $pc_cc_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_cr_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_pe_val_00_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_pe_val_01_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_pe_val_02_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_pe_val_03_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_pe_val_04_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_pe_val_05_%d/$pc_c_%d",$tmp,$tmp
    eval "p $pc_pe_val_06_%d/$pc_c_%d",$tmp,$tmp
    set $tmp=$tmp+1
  end
end

